#coding:utf-8
import urllib2
import urllib
import json
import time
#采用get方式请求
URL = 'http://openapi.baidu.com/public/2.0/bmt/translate?from=%s&to=%s&q=%s&client_id=%s'
API_Key = 'sypV6ThodHlHgUkNtMW5V2TL' #换成自己的APIKey
def trans(From,To, str):
    url = URL % (From, To, urllib.quote(str), API_Key)
    try:
        rsp = urllib2.urlopen(url)
    except Exception, e:
        raise Exception(u'链接服务器失败:' + str(e))
    rs = json.load(rsp)
    if 'error_code' in rs:
        raise Exception(u'翻译出错:' + rs['error_msg'])
    if rs['trans_result']:
        return rs['trans_result'][0]['dst']
    else:
        raise Exception('u无结果')
def zh2en(src):
    return trans('zh', 'en', src)
def en2zh(src):
    return trans('en', 'zh', src)

words_f = open("wordsEn.txt")

count = 0
left = [x.strip() for x in words_f.readlines() if sum([ord(i)-96 for i in x.strip()])==100]

for i in left:
    count +=1
    print i,
    print en2zh(i)
    # time.sleep()

print count